-
Notifications
You must be signed in to change notification settings - Fork 0
test(recipe): verify that clicking a card image opens the recipe #90
Conversation
Only the title link opened a recipe; clicking the image did nothing. Wrap the image in a link to the same page that is hidden from assistive technology and the tab order, so keyboard and screen-reader users still get a single link per card. Both links keep the browse state for Back. Closes #82
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requesting changes for two reasons:
-
Redundant image link: The existing
.recipe-card__title-link::afteroverlay already covers the entire card, including the image. Clicking the image should therefore already navigate through the title link, while the new image link remains covered by the overlay. The new unit test doesn't catch this because jsdom doesn't perform CSS hit-testing. -
Accessibility regression: Setting
aria-hidden="true"on the image link also hides potentially meaningful image alt text provided by other consumers from screen readers.
I'd suggest verifying the original issue in a real browser before adding another link, and ensuring descriptive alt text remains accessible.
Review on #90 was right: the title link's ::after overlay already covers the whole card, so clicking the image already opened the recipe (checked in a real browser). The extra aria-hidden image link was redundant and hid the image alt text from screen readers. Restore RecipeCard as before and add a browser test that clicks the image centre, since jsdom cannot hit-test the CSS overlay. Closes #82
|
Thanks — you were right on both points. I checked on |
…ts (#96) * fix(recipe): open the recipe when its card image is clicked Only the title link opened a recipe; clicking the image did nothing. Wrap the image in a link to the same page that is hidden from assistive technology and the tab order, so keyboard and screen-reader users still get a single link per card. Both links keep the browse state for Back. Closes #82 * feat(perf): cache images and assets, serve image thumbnails - Images: replace Cache-Control no-store with no-cache plus a strong ETag (public/private by recipe visibility). The access check still runs on every request, so privacy changes apply immediately, but unchanged images are answered with an empty 304 instead of being re-downloaded. - Thumbnails: the API generates 480/800 px WebP variants (?w=) with sharp on first request and caches them under UPLOAD_DIR/variants; cleanup removes them with the original. Recipe cards use srcset/sizes. A seed image goes from 133.6 KB to 18.2 KB at 480 px. - Apache: immutable one-year caching for hashed /assets, no-cache for index.html (deploy/apache.conf, needs mod_headers on the VM). - Fallback image resized to 800 px: 173.4 KB -> 51.2 KB. - GraphQL responses keep no-store. Closes #70 * feat(images): normalise uploads on the server and cover all variants Following team review of #70: - Every upload is processed with sharp on the server, whatever the client sent: EXIF auto-rotation, at most 1600 px on the longest side, WebP quality 80, metadata (e.g. GPS) dropped. Quotas use the stored size. Existing files and URLs are unchanged. - Card variants (480/800 px) are built at upload time; older images still get them lazily. The recipe detail image now uses srcset/sizes too. - The global storage limit counts variant files. Variants already go through the same authorization (incl. privacy changes) and cleanup. Refs #70 * test(recipe): cover card image clicks instead of adding a second link Review on #90 was right: the title link's ::after overlay already covers the whole card, so clicking the image already opened the recipe (checked in a real browser). The extra aria-hidden image link was redundant and hid the image alt text from screen readers. Restore RecipeCard as before and add a browser test that clicks the image centre, since jsdom cannot hit-test the CSS overlay. Closes #82 * fix(images): refresh replaced images, rotate variants, remove orphans Review on #96: - ETags include the original's size and mtime, and cached variants are rebuilt when the original is newer, so re-seeded images (same filenames) are never shown stale. - Variants apply EXIF auto-rotation, so older JPEG uploads stored before server-side normalisation are not shown sideways. - Cleanup removes variants (and interrupted .tmp writes) whose original no longer exists, so they stop counting against the storage limit. Refs #70
Changes
After review: the original finding behind #82 was wrong. The title link's
::afteroverlay (RecipeCard.css) already stretches over the whole card, so clicking the image already opened the recipe. I confirmed this in a real browser ondev(document.elementFromPointat the image centre is the title link, and clicking navigates).RecipeCardis restored exactly as ondev(the extraaria-hiddenimage link is gone, so meaningful image alt text from other consumers stays available to screen readers).Validation
npm run checkpasses; the new browser test passes.Thanks @olestan for the review.
AI usage
Written with Claude Code (Anthropic) to address a teammate's review of the final-delivery findings. Please review the diff as you would any other contribution.
Closes #82